From 138880600a0572ea13748e2c166f22727299a367 Mon Sep 17 00:00:00 2001 From: Keir Fraser Date: Thu, 18 Nov 2010 12:28:31 +0000 Subject: [PATCH] x86 hvm: Refuse to perform __hvm_copy() work in atomic context. Soon we will properly handle paged out memory in this function by sleeping in hypervisor context. This will require that all callers can sleep. If this check is too strong, we can reduce it to only applying to guests with paging enabled (which also currently implies only guests using Intel EPT). However my brief testing seems to indicate it works okay. Signed-off-by: Keir Fraser --- xen/arch/x86/hvm/hvm.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/xen/arch/x86/hvm/hvm.c b/xen/arch/x86/hvm/hvm.c index ccf0d88b9e..bede0ae658 100644 --- a/xen/arch/x86/hvm/hvm.c +++ b/xen/arch/x86/hvm/hvm.c @@ -1905,6 +1905,13 @@ static enum hvm_copy_result __hvm_copy( char *p; int count, todo = size; + /* + * If the required guest memory is paged out, this function may sleep. + * Hence we bail immediately if called from atomic context. + */ + if ( in_atomic() ) + return HVMCOPY_unhandleable; + while ( todo > 0 ) { count = min_t(int, PAGE_SIZE - (addr & ~PAGE_MASK), todo); -- 2.30.2